package com.ykdl.member.kid.regandlogin;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.ykdl.member.kid.R;
import com.ykdl.member.kid.gears.BaseScreen;
import com.ykdl.member.kid.util.ResoureUtil;

public class StateSelectActivity extends BaseScreen implements OnClickListener{
	
	private ImageView yunqi,baby,children;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setTopTitle("状态选择", 0, R.drawable.back_bg, new OnClickListener() {
			@Override
			public void onClick(View v) {
				
				finish();
			}
		}, 0, 0, null, R.drawable.title_bg, false);
		setContent(R.layout.activity_state_select);
		ResoureUtil.activityList.add(this);
		initView();
	}

	private void initView() {
		// TODO Auto-generated method stub
		yunqi=(ImageView) findViewById(R.id.yunqi);
		yunqi.setOnClickListener(this);
		baby=(ImageView) findViewById(R.id.baby);
		baby.setOnClickListener(this);
		children=(ImageView) findViewById(R.id.children);
		children.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		 Intent intent=new Intent(mContext, PerfectUserInfoActivity1.class);;
		switch (v.getId()) {
		case R.id.yunqi:
			intent.putExtra("COMEFROM", "yunqi");
			startActivity(intent);
			switchView(1);
			break;
		case R.id.baby:
			intent.putExtra("COMEFROM", "baby");	
			startActivity(intent);
			switchView(2);
			break;
		case R.id.children:
			intent.putExtra("COMEFROM", "children");
			startActivity(intent);
			switchView(3);
			break;

		default:
			break;
		}
	}
	
	public void switchView(int i){
			if(i==1){
				yunqi.setBackgroundResource(R.drawable.yun_select);
				baby.setBackgroundResource(R.drawable.baby_default);
				children.setBackgroundResource(R.drawable.child_default);
			}else if(i==2){
				yunqi.setBackgroundResource(R.drawable.yun_default);
				baby.setBackgroundResource(R.drawable.baby_select);
				children.setBackgroundResource(R.drawable.child_default);
			}else{
				yunqi.setBackgroundResource(R.drawable.yun_default);
				baby.setBackgroundResource(R.drawable.baby_default);
				children.setBackgroundResource(R.drawable.child_select);
			}
	}

}
